<?php
class Home extends Controller {
    function Home() {
        parent::Controller();
        $this->load->model('publicdata');
    }
    function index() {
        $setting = $this->publicdata->get_setting_sitename()->result();
        $data['sitetitle'] = $setting[0]->value;
        $data['username'] = $this->dx_auth->get_username();
        $this->session->set_userdata(array('user_id'=>$this->dx_auth->get_user_id()));
        $year=$this->publicdata->get_current_year();
        if($year->result()){
            foreach($year->result() as $row){
               $current_year=$row->id;
            }
            $this->session->set_userdata(array('year_id'=>$current_year));
        }
        $role='';
        if ( ! $this->dx_auth->is_logged_in()) {
            $data['url'] = anchor('auth/login');
        }
        if ($this->dx_auth->get_role_id()==1) {
            $role='student/student';
        }

         if ($this->dx_auth->get_role_id()==3) {
            $role='teacher/teacher';
        }
        
        if ($this->dx_auth->get_role_id()==7) {
           $role='admin/admin';
        }
        
        $this->load->view($role,$data);

    }
    function get_user_info() {
        $date['username'] = $this->dx_auth->get_username();
        
    }
    //核心页面
    function handin() {
        $this->load->view('assign/handin');
    }
    //学生首页
    function student() {
        $this->load->view('student/s_index');
    }
    //未过期作
    function active() {
        $this->load->view('student/active');
    }
    //按课程选择
    function accordingcourse() {
        $this->load->view('student/accordingcourse');
    }
    //按学期选择
    function accordingterm() {
        $this->load->view('student/accordingterm');
    }
    //选择列表
    function assignlist() {
        $this->load->view('student/assignlist');
    }
    //课程表
    function syllabus() {
        $this->load->view('syllabus');
    }
    //资源中心
    function resources() {
        $this->load->view('download');
    }
    function changepassword() {
        $this->load->view('changepassword');
    }
}

?>
